import requests
import json
from flask import Flask, jsonify, render_template

app = Flask(__name__, template_folder="dist", static_folder="dist", static_url_path="/")

@app.route('/')
def home():
    return render_template("index.html")

@app.route('/api')
def api():
    request_data = {
        "fprice": "",
        "tprice": "",
        "curr_iss_amt": "",
        "volume": "",
        "svolume": "",
        "premium_rt": "",
        "ytm_rt": "",
        "market": "",
        "rating_cd": "",
        "is_search": "N",
        "btype": "C",
        "listed": "Y",
        "sw_cd": "",
        "bond_ids": "",
        "rp": "50"
      }
    response = requests.post("https://www.jisilu.cn/data/cbnew/cb_list/?___jsl=LST___t=1595082240737", data=request_data)
    return jsonify(json.loads(response.text))

def main():
    app.run("0.0.0.0", 80, debug=True)

if __name__ == '__main__':
    main()